/*
This file is part of Docking@Home.
http://docking.gcl.cis.udel.edu
Copyright (C) 2009 University of Delaware

Docking@Home is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Docking@Home is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Docking@Home.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
	Filename: TabbedGUI.h
	Description: A high level class that will contain all information about
		our tabbed GUI layout and will handle events sent to it.
	Revision History: 
		Created - 11/19/07
		Made into the window manager - 01/02/08
	Author: Robert Keller (11/19/07 -> current)
*/

#ifndef _TabbedGUI_h
#define _TabbedGUI_h

#include <vector>

using std::vector;

#include "../GLHelper.h"
#include "../Logo.h"
#include "Tab.h"
#include "TabWindow.h"
#include "../Interact/Interact.h"

#include "graphics2.h"
#include "app_ipc.h"

#define MAX_WORKUNIT_NAME_LENGTH 10


class TabbedGUI
{
public:

	// Constructor / Destructor
	TabbedGUI();
	~TabbedGUI();

	// Initialization Functions
	
	void init(APP_INIT_DATA uc_aid);	
	void init(const float border[4], 
		const float complexTextColor[4], 
		APP_INIT_DATA uc_aid);	

	// Tab Functions

	int addTab (Tab * tab, unsigned int preferredIndex = 0);
	Tab * removeTab (int num);

	// Tab Window Functions

	void resize (int w, int h, bool bFullscreen = false);

	// Render Functions

	void draw(double screenWidth, double screenHeight, 
		bool bFullScreen);
	void drawGUI(double screenWidth, double screenHeight);
	void drawScreenSaver(double screenWidth, 
		double screenHeight);

	// Input Functions

	void handleMouseMove (int x, int y, int left, 
		int middle, int right);
	void handleMouseButton (int x, int y, int which, 
		int is_down);
	void handleKeyPress (int key1, int key2);	
	void handleKeyRelease (int key1, int key2);

private:

	// Set Workunit Name
	void setWUName(char * wu_name);

	// Tab Interaction Functions

	void handleTabMouseInteraction (int x, int y,
		bool leftClicked);

	// List of tabs
	vector <Tab *> tabs;

	// Event based variables
	int currentTab;

	// Render Variables
	
	static GLHelper * glHelper;

	// Area where the tab should render its information
	TabWindow tabWindow;
	
	// Complex Text Properties
	float complexTextXScale;
	float complexTextYScale;

	float complexTextXStandardScale;
	float complexTextYStandardScale;
	
	float complexTextColor[4];

	// Work Unit's Name
	char wuName[MAX_WORKUNIT_NAME_LENGTH];

	// Logo Variables
	Logo logo;
	const float LOGO_SIZE_FACTOR;

	//news ticker
	NewsTicker *ticker;
};

#endif

